import java.sql.SQLOutput;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lyn
 * Date: 2025-01-12
 * Time: 10:32
 */
public class text {
    //计算1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100 的值
    public static void main(String[] args) {
        double n = 1;
        int f = 1;
        double sum = 0;
        for (int i = 1; i <= 100; i++) {
            sum += f * (n / i);
            f = -f;
        }
        System.out.println(sum);
    }
    //编写程序数一下 1到 100 的所有整数中出现多少个数字9
    public static void main5(String[] args) {
        int i=0;
        int count=0;
        for ( i = 10; i < 100; i++) {
            int sw = i / 10;
            int gw = i % 10;
            if(sw == 9 || gw == 9)
                count++;
        }
        System.out.println(++count);
    }
    //判断一个数是不是素数
    public static void main4(String[] args) {
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        int i=0;
        for (i = 2; i < Math.sqrt(n); i++) {
            if(n % i == 0)
                break;
        }
        if(i > Math.sqrt(n))
            System.out.println("isprime");
        else
            System.out.println("noprime");
    }
    //多次输入输出
    public static void main3(String[] args) {
        Scanner scan=new Scanner(System.in);
        while (scan.hasNextInt()){
            int n=scan.nextInt();
            System.out.println(n);
        }
    }
    //练习输入输出
    public static void main2(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入你的姓名：");
        String name=scan.nextLine();
        System.out.println("姓名："+name);
        System.out.println("请输入你的年龄：");
        int years = scan.nextInt();
        System.out.println("年龄："+years);
        System.out.println("请输入你的性别");
        scan.nextLine();//注意回车
        String sex=scan.nextLine();
        System.out.println("性别："+sex);
        scan.close();
    }
    //打印出100-200之间既能被三整除又能被四整除的数字
    public static void main1(String[] args) {
        int n=100;
        for(n=100;n<200;n++){
            if(n % 3!= 0 || n % 4 !=0){
                continue;
            }
            System.out.println(n);
        }
    }
}
